import { formatTimestamp } from '@/utils/format'
import { getTextByCode } from './utils/getTextByCode'
import { formatMoney } from '@/utils/util'

export const BATCH_PAY_TYPE = {
  10: '线上支付',
  20: '线下支付'
}

export const BATCH_STATUS = {
  0: '待处理',
  1: '处理中',
  2: '已完成',
  9: '异常'
}

export const CHECK_STATUS = {
  0: '待验收',
  1: '申请验收',
  2: '验收通过',
  3: '验收未通过'
}


export const projectDetail = {
  member: {
    columns: [
      {
        title: '姓名',
        dataIndex: 'name',
        key: 'name',
        scopedSlots: { customRender: 'name' }
      },
      {
        title: '手机号',
        dataIndex: 'phone',
        key: 'phone',
         width: 120,
         ellipsis: true
      },
      {
        title: '身份证号',
        dataIndex: 'idcardNum',
        width: 120,
        key: 'idCard',
        ellipsis: true
      },
      {
        title: '开户行',
        dataIndex: 'bankName',
        key: 'bankName',
        width: 120,
        ellipsis: true
      },
      {
        title: '银行卡号',
        dataIndex: 'bankCardNum',
        width: 100,
        key: 'bankCard',
        ellipsis: true
      },
      {
        title: '众包费',
        dataIndex: 'salaryFee',
        width: 150,
        key: 'fee',
        scopedSlots: { customRender: 'money' }
        // ellipsis: true
      },
      {
        title: '状态',
        dataIndex: 'checkStatus',
        key: 'checkStatus',
        width: 100,
        customRender: checkStatus => getTextByCode(checkStatus, CHECK_STATUS)
        //scopedSlots: { customRender: 'status' }
        // ellipsis: true
      },
      {
        title: '备注',
        dataIndex: 'remark',
        key: 'remark'
        // ellipsis: true
      },
      {
        title: '操作',
        key: 'operation',
        width: 130,
        scopedSlots: { customRender: 'operation' }
      }
    ]
  },
  acceptance: {
    columns: [
      {
        title: 'ID',
        dataIndex: 'reportId',
        key: 'ID'
      },
      {
        title: '众包费',
        dataIndex: 'salaryFee',
        key: 'salaryFee',
        // width: 150,
        scopedSlots: { customRender: 'money' }
      },
      {
        title: '服务费',
        dataIndex: 'manageFee',
        key: 'manageFee',
        // width: 150,
        scopedSlots: { customRender: 'money' }
      },
      {
        title: '总费用',
        dataIndex: 'totalFee',
        key: 'totalFee',
        // width: 150,
        scopedSlots: { customRender: 'money' }
      },
      {
        title: '验收时间',
        dataIndex: 'modifiedTime',
        key: 'modifiedTime',
        // ellipsis: true,
        // width: 180,
        scopedSlots: { customRender: 'modifiedTime' }
      },
      {
        title: '项目成员',
        dataIndex: '--',
        key: '---',
        scopedSlots: { customRender: 'membersAction' }
      },
      {
        title: '验收说明',
        dataIndex: 'remark',
        key: 'remark'
      },
      {
        title: '验收附件',
        dataIndex: 'checkAttachment',
        key: 'file',
        scopedSlots: { customRender: 'file' }
      }
    ]
  },
  business:{
    columns:[
      {
        title: '订单ID',
        dataIndex: 'batchId',
        fixed: 'left'
      },
      // {
      //   title: '企业名称',
      //   dataIndex: 'enterpriseName',
      //   width: 150,
      //   ellipsis: true
      // },
      {
        title: '总笔数',
        dataIndex: 'personCount'
      },
      {
        title: '众包费',
        dataIndex: 'afterFee',
        customRender: afterFee => formatMoney(afterFee),
        customExportRender: afterFee => formatMoney(afterFee).substring(2)
      },
      {
        title: '服务费',
        dataIndex: 'manageFee',
        customRender: manageFee => formatMoney(manageFee),
        customExportRender: manageFee => formatMoney(manageFee).substring(2)

      },
      {
        title: '总费用',
        dataIndex: 'totalFee',
        customRender: totalFee => formatMoney(totalFee),
        customExportRender: totalFee => formatMoney(totalFee).substring(2)
      },
      {
        title: '支付方式',
        dataIndex: 'payType',
        customRender: type => getTextByCode(type, BATCH_PAY_TYPE)
      },
      {
        title: '状态',
        dataIndex: 'settleStatus',
        customRender: status => getTextByCode(status, BATCH_STATUS)
      },
      {
        title: '创建时间',
        dataIndex: 'createdDate',
        customRender: date => formatTimestamp(date)
      },
      {
        title: '操作',
        dataIndex: 'action',
        width: '140px',
        scopedSlots: { customRender: 'action' },
        fixed: 'right'
      }
    ]
  }
}
